Implement Result::getQueryResult() - #14
Open
simon-mundy wants to merge 2 commits into
Open
Conversation
php-db/phpdb#172 added getQueryResult() to Driver\ResultInterface, so Pgsql\Result no longer satisfied the contract and loading the class was a fatal before any test could run. Follows Pdo\Result upstream: guard on isQueryResult(), clone the given prototype or a default ResultSet, and initialize it from this result. php-db/phpdb 0.6.x-dev requires php ^8.3, so the php constraint, config.platform.php and the PhpStan check in .laminas-ci.json move to 8.3 — the lock cannot pick up the interface change otherwise. Covered by unit tests over a ResultStub that answers the two methods reading the pgsql resource, and by integration tests running a real select and a fields-less statement through the native driver.
The PhpStan check in .laminas-ci.json runs on latest dependencies, so it picks up phpstan 2.2, which no longer reports the two implode argument.type errors in Metadata\Source. The baseline still ignored them, so the job failed on ignore.unmatched, which is non-ignorable. 2.1 does still report them, so the entries cannot simply be removed while the lock stays on 2.1; require-dev moves to ^2.2 so both the locked and latest jobs analyse with a version that agrees. Pre-existing on 0.1.x, and unrelated to getQueryResult, but it fails this PR's CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #12.
Driver\ResultInterface::getQueryResult()arrived in php-db/phpdb#172 andPgsql\Resultnever implemented it, so loading the class was a fatal andcomposer updatefollowed bycomposer testfailed before a single test ran.Implemented as
Pdo\Resultdoes upstream: guard onisQueryResult(), clone the given prototype or a defaultResultSet, initialize it from this result.php-db/phpdb0.6.x-devrequires php^8.3, so the lock cannot pick up the interface change while the package still allows 8.2. The php constraint,config.platform.phpand the PhpStan check in.laminas-ci.jsonmove to 8.3 with it. That is part of #10, brought forward here because the fix cannot install otherwise.Test plan
test/unit/ResultTest.phpcovers the seeded result set, the prototype clone and the rejection, usingPhpDbTestAsset\Pgsql\ResultStubto answerisQueryResult()andgetFieldCount()— the only two methodsgetQueryResult()reaches that read the pgsql resource, which needs a live connection.test/integration/ResultTest.phpcovers the real path through the native driver: a select seeding a result set with the right field count and rows, andSET search_path TO publicas a statement with no fields.phpcs, phpstan and the unit suite pass. The integration suite has not been run locally — no Postgres available here — so it runs for the first time in CI.
Notes
Ordering: this should land before #11, which is blocked on it. Six of that PR's matrix legs fail with this fatal, and its
codecovandmutation-testjobs stay skipped while anytestleg is red. #11 then rebases and drops its own copy of the php constraint change.composer auditreports a high-severity command injection advisory againstsquizlabs/php_codesniffer(CVE-2026-67434, fixed in 3.13.6). It arrives throughlaminas/laminas-coding-standard, which #11 removes, so no fix here.